import { Modifier } from './modifier';
import { Inventory } from './inventory';

export interface Cart {
    items: CartItem[];
    qty: number;
}

export interface CartItem {
    id: string;
    amount: number;
    actualPrice: number;
    discount: number;
    extended: CartItemExtend;
    inventory: Inventory;
    inventoryCode: string;
    inventoryId: string;
    inventoryName: string;
    isEntireDiscount: boolean;
    price: number;
    qty: number;
    showOrder: number;
    total: number;
    refundQty: number;
    status: string;
    modifiers: {
        amount: number;
        items: Modifier[]
    };
}

interface CartItemExtend {
    dishup: DisHup;
    promotion: string; //促销
    categories: any;

    /**
     * waiting(等叫) | pickup(叫起) 
     * 
     * @type {string}
     * @memberOf CartItemExtend
     */
    pickup: string;
    //赠送会拆单 指向原单
    refItemId: string;
    // 组织商品
    combo?: {
        group: {
            items: {
                inventory: string;
                inventoryCode: string;
                inventoryId: string;
                inventoryName: string;
                qty: number;
                price: number;
            }[]
        }[]
    };
}

interface DisHup {
    operateTime: Date;
    operator: { id: string, name: string };
    operatorId: string;
    qty: number;
    //all | part | none 
    status: string;
}